package org.travel.app.controller;

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.travel.app.common.util.VerificationCodeUtil;
import org.travel.app.common.vo.ResultVO;
import org.travel.app.entity.user.User;
import org.travel.app.service.impl.UserServiceImpl;

/**
 * @author nmm
 * @date 2024-12-2024/12/1
 * @deriction njm......
 */
@RestController
@RequestMapping("/user")
@RequiredArgsConstructor
public class RegisterController extends BaseController{
    private final UserServiceImpl userService;

    @GetMapping("/getVerCode")
    public ResultVO getVerCode() {
        return success(VerificationCodeUtil.generateCode());
    }

    @PostMapping("/registerUser")
    public ResultVO addUser(@RequestBody User user) {
        userService.addUser(user);
        return success();
    }

}